Kanzi  3.9.9
Kanzi Engine C++ API
log_level.hpp File Reference
#include <boost/preprocessor/comparison/less_equal.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/facilities/expand.hpp>

Namespaces

 kanzi
 

Macros

#define KZ_LOG_CREATE_LEVEL(value, name)
 Creates a log level. More...
 
#define KZ_LOG_GET_LEVEL_NAME(level)
 Gets a log level name. More...
 
#define KZ_LOG_GET_LEVEL_VALUE(level)
 Gets a log level value. More...
 
#define KZ_LOG_IS_LEVEL_ENABLED(level)
 Checks whether a log level is enabled. More...
 
#define KZ_LOG_LEVEL_ENABLED_THRESHOLD
 To set the enabled log level threshold, define this macro to one of the existing log levels. More...
 
#define KZ_LOG_LEVEL_ERROR
 Use the error log level to log critical malfunction messages. More...
 
#define KZ_LOG_LEVEL_INFO
 Use the info log level to log information messages that give a brief overview of what is happening in the system, log states passed, static information about configuration, and so on. More...
 
#define KZ_LOG_LEVEL_TRACE
 Use the trace log level to get the maximum amount of information about the system. More...
 
#define KZ_LOG_LEVEL_WARNING
 Use the warning log level to log facts that require attention, but do not necessarily mean malfunction. More...
 

Enumerations

enum  kanzi::LogLevel { kanzi::LogLevelError, kanzi::LogLevelWarning, kanzi::LogLevelInfo, kanzi::LogLevelTrace }
 The log levels. More...
 

Detailed Description

Log Level

The Logging subsystem provides several log levels that you can use to classify log messages. See Log levels. Log levels are ordered according to their severity. To implement the ordering, a distinct integer number is assigned to each level. The most severe log level is the error log level (KZ_LOG_LEVEL_ERROR), which is assigned the value 1. The larger the log level value is, the less severe the message. To get the integer value assigned to a log level, use the KZ_LOG_GET_LEVEL_VALUE macro.

Each log level has a name, which is a short string describing the log level. For example, "error". A logger can use the name when writing a log message. See kanzi::AbstractLogger. To get the name of a log level, use the KZ_LOG_GET_LEVEL_NAME macro.

These are the log levels available in the Kanzi logging subsystem:

Log level Severity value Name
KZ_LOG_LEVEL_ERROR 1 error
KZ_LOG_LEVEL_WARNING 2 warning
KZ_LOG_LEVEL_INFO 3 info
KZ_LOG_LEVEL_TRACE 4 trace

The KZ_LOG_LEVEL_ENABLED_THRESHOLD macro defines which log levels are enabled. A log level is enabled if it is the same or more severe than the log level that KZ_LOG_LEVEL_ENABLED_THRESHOLD is set to. Otherwise the log level is disabled. To check whether a particular log level is enabled, use the KZ_LOG_IS_LEVEL_ENABLED macro. To learn how the state of the log level affects message filtering, see Classifying and filtering log messages.

The integer value assigned to the log level along with its name are passed to the KZ_LOG_CREATE_LEVEL macro when the log level is defined. See Log levels for details.

Macro Definition Documentation

#define KZ_LOG_LEVEL_ENABLED_THRESHOLD

To set the enabled log level threshold, define this macro to one of the existing log levels.

The log level set in the KZ_LOG_LEVEL_ENABLED_THRESHOLD macro and all the log levels with higher severity are enabled. The log levels less severe than the one set in KZ_LOG_LEVEL_ENABLED_THRESHOLD are disabled. If you do not define this macro before including this header, it is defined to the default value of KZ_LOG_LEVEL_INFO. To learn how KZ_LOG_LEVEL_ENABLED_THRESHOLD is used in message filtering, see Log Level.